home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / emacs16d.zip / _SEARCHE.MIN < prev    next >
Text File  |  1991-07-19  |  14KB  |  704 lines

  1.  
  2.  
  3.  
  4. Name:F:flash-rbrace
  5. Move the cursor back to the matching }
  6. [*]#(Fflash-paren,{,})[*]
  7.  
  8.  
  9. Name:F:flash-rbracket
  10. Move the cursor back to the matching ]
  11. [*]#(Fflash-paren,[,])[*]
  12.  
  13.  
  14. Name:F:flash-rpar
  15. Move the cursor back to the matching )
  16. [*]#(Fflash-paren,(##(bc,40,d,a)),(##(bc,41,d,a)))[*]
  17.  
  18.  
  19. Name:F:isearch-backward
  20. Incrementally search backwards.  Use C-s to search forwards again and C-r to
  21. search backwards again.
  22. [*]#(Fisearch,-1)[*]
  23.  
  24.  
  25. Name:F:isearch-forward
  26. Incrementally search forwards.  Use C-s to search forwards again and C-r to
  27. search backwards again.
  28. [*]#(Fisearch,1)[*]
  29.  
  30.  
  31. Name:F:isearch-forward-regexp
  32. Incrementally search forwards using a regexp.  Use C-s to search forwards
  33. again and C-r to search backwards again.
  34. [*]#(Fisearch,1,Regexp )[*]
  35.  
  36.  
  37. Name:F:query-replace
  38. Search for a string and give the user a chance to replace it with another.
  39. [*]#(ds,value,##(old-search))
  40. #(Freadline,Query replace: ,(
  41.     #(ds,old-search,##(value))
  42.     #(ds,value,##(old-replace))
  43.     #(Freadline,(Query replace ##(old-search) with: ),(
  44.         #(ds,old-replace,##(value))
  45.         #(an,Query replacing ##(old-search) with ##(old-replace)--'?' for help)
  46.         #(Freplace-with)
  47.     ))
  48. ))[*]
  49.  
  50.  
  51. Name:F:query-replace-regexp
  52. [*]#(ds,value,##(old-search))
  53. #(Freadline,Query replace regexp: ,(
  54.     #(ds,old-search,##(value))
  55.     #(ds,value,##(gs,old-replace,\\,\&))
  56.     #(Freadline,(Query replace regexp ##(old-search) with: ),(
  57.         #(ds,old-replace,##(value))
  58.         #(an,Query replacing regexp ##(old-search) with ##(old-replace)--'?' for help)
  59.         #(mp,old-replace,\\,\&)
  60.         #(Freplace-with,,!)
  61.         #(Fmessage,Done)
  62.     ))
  63. ))[*]
  64.  
  65.  
  66. Name:F:replace-regexp
  67. Replace all strings matching a given regexp with another string.
  68. [*]#(ds,value,##(old-search))
  69. #(Freadline,Replace regexp: ,(
  70.     #(ds,old-search,##(value))
  71.     #(ds,value,##(gs,old-replace,\\,\&))
  72.     #(Freadline,(Replace regexp ##(old-search) with: ),(
  73.         #(ds,old-replace,##(value))
  74.         #(mp,old-replace,\\,\&)
  75.         #(Freplace-with,!,!)
  76.     ))
  77. ))[*]
  78.  
  79.  
  80. Name:F:replace-string
  81. Replace all strings matching a given string with another string.
  82. [*]#(ds,value,##(old-search))
  83. #(Freadline,Replace: ,(
  84.     #(ds,old-search,##(value))
  85.     #(ds,value,##(old-replace))
  86.     #(Freadline,(Replace ##(old-search) with: ),(
  87.         #(ds,old-replace,##(value))
  88.         #(Freplace-with,!)
  89.     ))
  90. ))[*]
  91.  
  92.  
  93. Name:F:search-backward
  94. [*]#(Finsist,(arg1),SELF,(
  95.     #(lp,(arg1))
  96.     #(pm,1)
  97.     #(l?,.,[,0,,(
  98.         #(sp,0)
  99.     ),(
  100.         #(Fmessage,(arg1 not found))
  101.     ))
  102.     #(pm)
  103. ))[*]
  104.  
  105.  
  106. Name:F:search-forward
  107. Prompts for search string, after first offering use of string from
  108. last search.  Point is set to just beyond the end of the found string.
  109.  
  110. [*]#(Finsist,(arg1),SELF,(
  111.     #(lp,(arg1))
  112.     #(pm,1)
  113.     #(l?,.,],,0,(
  114.         #(sp,0)
  115.     ),(
  116.         #(Fmessage,(arg1 not found))
  117.     ))
  118.     #(pm)
  119. ))[*]
  120.  
  121.  
  122. Name:F:vip-match-paren
  123. Find the paren that matches the one we're pointing to right now.
  124. [*]#(==,#(Fvip-match-paren),no,(#(Fmessage,Not on a paren)))[*]
  125.  
  126.  
  127. Name:F:word-search-backward
  128. [*]#(Finsist,(arg1),SELF,(
  129.     #(ds,temp,(arg1))
  130.     #(mp,temp,, )
  131.     #(ds,temp,##(temp,([     
  132. ]*)))
  133.     #(lp,##(temp),,r)
  134.     #(pm,1)
  135.     #(l?,.,[,0,,(
  136.         #(sp,0)
  137.     ),(
  138.         #(Fmessage,(arg1 not found))
  139.     ))
  140.     #(pm)
  141. ))[*]
  142.  
  143.  
  144. Name:F:word-search-forward
  145. [*]#(Finsist,(arg1),SELF,(
  146.     #(ds,temp,(arg1))
  147.     #(mp,temp,, )
  148.     #(ds,temp,##(temp,([     
  149. ]*)))
  150.     #(lp,##(temp),,r)
  151.     #(pm,1)
  152.     #(l?,.,],0,,(
  153.         #(sp,0)
  154.     ),(
  155.         #(Fmessage,(arg1 not found))
  156.     ))
  157.     #(pm)
  158. ))[*]
  159.  
  160.  
  161. Name:Fbackward-find-paren
  162. Look for the closest previous arg2 or arg3.  If we found an arg2 between
  163. point and arg1, see if we're done matching, otherwise keep searching.
  164. [*]#(pm,4)
  165. #(sm,3,arg1)
  166. #(SELF-do,0,(arg2),(arg3))
  167. #(pm)
  168. [*]
  169.  
  170.  
  171. Name:Fbackward-find-paren-do
  172. Look for the closest previous arg2 or arg3.  If we found an arg2 between
  173. point and mark 3, see if we're done matching, otherwise keep searching.
  174. [*]
  175. #(lp,arg2)
  176. #(l?,.,3,1,,,(
  177.     #(sm,1,3)
  178. ))
  179. #(lp,arg3)
  180. #(l?,.,3,2,,,(
  181.     #(sm,2,3)
  182. ))
  183. #(g?,##(rc,1),##(rc,2),(
  184.     #(sp,2)
  185.     #(==,##(rc,3),0,no,(
  186.         #(SELF,##(++,arg1,1),(arg2),(arg3))
  187.     ))
  188. ),(
  189.     #(sp,1)
  190.     #(==,##(rc,3),0,no,(
  191.         #(==,arg1,1,yes,(
  192.             #(SELF,##(--,arg1,1),(arg2),(arg3))
  193.         ))
  194.     ))
  195. ))[*]
  196.  
  197.  
  198. Name:Ffind-a-match
  199. Given a comma-terminated list of strings,
  200.   return arg2 if there are none of them,
  201.   return arg3 if there is one of them,
  202.   return arg4 if there are multiple (and set ##(temp) to the
  203.     longest common prefix).
  204.   Ignore arg5 characters at the beginning of each string.
  205. [*]#(ds,temp,(arg1))
  206. #(es,longest-matched)
  207. #(SELF-do,(arg2),(arg3),(arg4),(arg5),#(temp))
  208. [*]
  209.  
  210.  
  211. Name:Ffind-a-match-do
  212. [*]#(==,arg5,,(
  213.     arg1
  214. ),(
  215.     #(==,arg6,,(
  216.         #(ds,temp,arg5)
  217.         arg2
  218.     ),(
  219.         #(Flongest-prefix,##(temp),arg4)
  220.         #(n?,longest-matched,(
  221.             arg2
  222.         ),(
  223.             arg3
  224.         ))
  225.     ))
  226. ))[*]
  227.  
  228.  
  229. Name:Fflash-paren
  230. Search backwards for the previous matching arg1 that matches arg2.  Only
  231. search as far as the preceding double blank line.
  232. By the way, #(Fflash-paren,begin,end) works just fine, but #(Fflash-paren,",")
  233. doesn't.  I suppose that if you alternately searched for 'left' then 'right',
  234. you might have *some* success, but who knows.
  235. [*]#(Fself-insert,(arg2))
  236. #(rd)
  237. #(pm,4)
  238. #(lp,(
  239.  
  240.  
  241. ))
  242. #(l?,.,[,3,,,(
  243.     #(sm,3,[)
  244. ))
  245. #(sm,0)
  246. #(==,#(SELF-do,0,(arg1),(arg2)),yes,(
  247.     #(rd)
  248. ))
  249. #(sp,0)
  250. #(pm)
  251. #(n?,kbd-buffer,,(
  252.     #(ds,temp,#(it,100))
  253.     #(==,##(temp),Timeout,,(
  254.         #(Fkbd-in,##(temp))
  255.     ))
  256. ))
  257. [*]
  258.  
  259.  
  260. Name:Fflash-paren-do
  261. Skip backwards over pairs of delimiters.  arg2 is the opening
  262. delimiter, and arg3 is the closing delimiter.  arg1 is the count of open
  263. delimiters.
  264. [*]#(lp,arg2)
  265. #(==,
  266.     #(l?,.,3,1,,,(
  267.         #(sm,1,3)
  268.         no
  269.     ))
  270.     #(lp,arg3)
  271.     #(l?,.,3,2,,,(
  272.         #(sm,2,3)
  273.         no
  274.     ))
  275. ,nono,no,(
  276.     #(==,##(it,0),Timeout,(
  277.         #(g?,##(rc,1),##(rc,2),(
  278.             #(sp,2)
  279.             #(SELF,##(++,arg1,1),(arg2),(arg3))
  280.         ),(
  281.             #(sp,1)
  282.             #(==,arg1,1,yes,(
  283.                 #(SELF,##(--,arg1,1),(arg2),(arg3))
  284.             ))
  285.         ))
  286.     ),no)
  287. ))[*]
  288.  
  289.  
  290. Name:Fforward-find-paren
  291. Look for the closest previous arg2 or arg3.  If we found an arg2 between
  292. point and arg1, see if we're done matching, otherwise keep searching.
  293. [*]#(pm,4)
  294. #(sm,3,arg1)
  295. #(SELF-do,0,(arg2),(arg3))
  296. #(pm)
  297. [*]
  298.  
  299.  
  300. Name:Fforward-find-paren-do
  301. Look for the closest previous arg2 or arg3.  If we found an arg2 between
  302. point and mark 3, see if we're done matching, otherwise keep searching.
  303. [*]
  304. #(lp,arg2)
  305. #(l?,.,3,,1,,(
  306.     #(sm,1,3)
  307. ))
  308. #(lp,arg3)
  309. #(l?,.,3,,2,,(
  310.     #(sm,2,3)
  311. ))
  312. #(g?,##(rc,1),##(rc,2),(
  313.     #(sp,2)
  314.     #(==,##(rc,3),0,no,(
  315.         #(==,arg1,1,yes,(
  316.             #(SELF,##(--,arg1,1),(arg2),(arg3))
  317.         ))
  318.     ))
  319. ),(
  320.     #(sp,1)
  321.     #(==,##(rc,3),0,no,(
  322.         #(SELF,##(++,arg1,1),(arg2),(arg3))
  323.     ))
  324. ))[*]
  325.  
  326.  
  327. Name:Fisearch
  328. Incrementally search.  Use arg1 as the initial direction (null==forward).
  329. If arg2 is non-null, use regular expressions.
  330. We use mark 0 as the original match location, mark 3 as the last succeeding
  331. match location.
  332. [*]#(pm,4)
  333. #(sm,0)
  334. #(ds,isearch-count,arg1)
  335. #(ds,isearch-regexp,arg2)
  336. #(ds,value)
  337. #(es,mode-hook)
  338. #(SELF-do,(
  339.     #(an,##(value))
  340.     #(ds,old-search,##(value))
  341. ),b)
  342. #(pm)
  343. [*]
  344.  
  345.  
  346. Name:Fisearch-do
  347. Decide what key to execute during incremental search.
  348. [*]#(sp,0)
  349. #(==,#(lp,##(value),no,##(isearch-regexp),##(F-case-fold-search)),no,(
  350.     #(an,
  351.         ##(isearch-regexp)
  352.         I-Search [##(isearch-count)]:##(value)
  353.     ,, [incomplete input])
  354. ),(
  355.     #(==,
  356.         #(==,##(value),,(
  357.             #(ds,isearch-count,##(g?,##(isearch-count),0,1,-1))
  358.             yes
  359.         ),(
  360.             #(g?,##(isearch-count),0,(
  361.                 #(SELF-search-forward,##(isearch-count),])
  362.             ),(
  363.                 #(SELF-search-backward,##(isearch-count),[)
  364.             ))
  365.         ))
  366.     ,no,(
  367.         #(an,
  368.             Failing 
  369.             ##(isearch-regexp)
  370.             I-Search [##(isearch-count)]:##(value)
  371.         )
  372.         #(n?,matching,(
  373.             #(bl)
  374.         ))
  375.         #(es,matching)
  376.         #(n?,kbd-macro-g,(
  377.             #(ds,kbd-count)
  378.             #(ds,kbd-buffer,Escape<>)
  379.         ))
  380.         #(sp,3)
  381.     ),(
  382.         #(an,
  383.             ##(isearch-regexp)
  384.             I-Search [##(isearch-count)]:##(value)
  385.         )
  386.         #(sm,3)
  387.         #(ds,match-value,##(value))
  388.         #(ds,matching)
  389.         #(ds,match-count,##(isearch-count))
  390.     ))
  391. ))
  392. #(rd)
  393. #(Fmode-line)
  394. #(ds,temp,#(SELF-do,#(g),(arg1),arg2))
  395. #(==,##(temp),again,(
  396.     #(SELF,(arg1))
  397. ),(
  398.     ##(temp)
  399. ))
  400. [*]
  401.  
  402.  
  403. Name:Fisearch-do-do
  404. Decide what key to execute during incremental search.
  405. [*]#(Fcase,#(Fisearch-do-key,arg1,,arg3),
  406.     (again,again),
  407.     (done,),
  408.     (
  409.         #(n?,Fkey2char.arg1,(
  410.             #(Freadline.other,##(Fkey2char.arg1))
  411.         ),(
  412.             #(==,##(nc,arg1),1,(
  413.                 #(Freadline.other,arg1)
  414.             ),(
  415.                 #(an)
  416.                 #(ds,old-search,##(value))
  417.                 #(Fkbd-in,arg1)
  418.             ))
  419.         ))
  420.     )
  421. )[*]
  422.  
  423.  
  424. Name:Fisearch-do-key
  425. [*]#(Fcase,arg1,
  426.     (#(F-search-delete-char,arg1),(#(Freadline.C-h))),
  427.     (#(F-search-exit-char,arg1),(#(Fisearch.Escape,arg3))),
  428.     (#(F-search-quote-char,arg1),(#(Freadline.C-q))),
  429.     (#(F-search-repeat-char,arg1),(#(Fisearch.direction,arg3,no,yes,1))),
  430.     (#(F-search-reverse-char,arg1),(#(Fisearch.direction,arg3,yes,no,-1))),
  431.     (#(F-search-yank-line-char,arg1),(#(Fisearch.C-y))),
  432.     (#(F-search-yank-word-char,arg1),(#(Freadline.C-o))),
  433.     (#(==,arg1,C-g,(#(Fisearch.C-g)),none))
  434. )[*]
  435.  
  436.  
  437. Name:Fisearch-do-search
  438. Search backward during incremental search.
  439. [*]#(==,arg1,0,yes,(
  440.     #(g?,arg1,0,(
  441.         #(l?,.,],1,2,(
  442.             #(sp,2)
  443.             #(SELF,#(--,arg1,1))
  444.         ),no)
  445.     ),(
  446.         #(l?,.,[,1,2,(
  447.             #(sp,1)
  448.             #(SELF,#(++,arg1,1))
  449.         ),no)
  450.     ))
  451. ))[*]
  452.  
  453.  
  454. Name:Fisearch-do-search-backward
  455. Search backward during incremental search.
  456. [*]#(==,arg1,0,yes,(
  457.     #(l?,.,arg2,1,2,(
  458.         #(sp,1)
  459.         #(SELF,#(++,arg1,1),arg2)
  460.     ),no)
  461. ))[*]
  462.  
  463.  
  464. Name:Fisearch-do-search-forward
  465. Search forward during incremental search.
  466. [*]#(==,arg1,0,yes,(
  467.     #(l?,.,arg2,1,2,(
  468.         #(sp,2)
  469.         #(SELF,#(--,arg1,1),arg2)
  470.     ),no)
  471. ))[*]
  472.  
  473.  
  474. Name:Fisearch.C-g
  475. Handle C-g during incremental search.  If we found a match, just kill the
  476. input.  If we haven't found a match, kill what we didn't match.
  477. [*]#(n?,matching,(
  478.     #(F:ring-the-bell)
  479.     #(sp,0)
  480.     done
  481. ),(
  482.     #(ds,isearch-count,##(match-count))
  483.     #(ds,value,##(match-value))
  484.     again
  485. ))[*]
  486.  
  487.  
  488. Name:Fisearch.C-y
  489. Read the rest of the line out of the text buffer.
  490. [*]#(==,arg2,,,(#(ds,value)))
  491. #(ds,value,##(value)##(rm,$))
  492. #(sp,$)
  493. again[*]
  494.  
  495.  
  496. Name:Fisearch.Escape
  497. Process search-exit-char.
  498. [*]#(==,##(value),,(
  499.     #(es,value,2nd-half,readline-msg)
  500.     #(Freadline-an,search-##(g?,##(isearch-count),0,forward,backward): )
  501.     #(ds,temp,#(g))
  502.     #(==,##(temp),C-w,(
  503.         #(F:word-search-##(g?,##(isearch-count),0,forward,backward))
  504.     ),(
  505.         #(Fkbd-in,##(temp),x)
  506.         #(F:search-##(g?,##(isearch-count),0,forward,backward))
  507.     ))
  508. ),(
  509.     #(an,##(value))
  510.     #(ds,old-search,##(value))
  511. ))
  512. done[*]
  513.  
  514.  
  515. Name:Fisearch.direction
  516. Arg1 is non-null if this is the first character after entering isearch mode.
  517. Arg4 is the direction to bump the count.
  518. [*]#(==,arg1,,(
  519.     #(==,#(n?,matching,yes,(
  520.             #(g?,##(isearch-count),0,arg2,arg3)
  521.             ))
  522.     ,no,(
  523.         #(bl)
  524.     ),(
  525.         #(ds,isearch-count,##(++,##(isearch-count),arg4))
  526.         #(==,##(isearch-count),0,(
  527.             #(ds,isearch-count,arg4)
  528.         ))
  529.     ))
  530. ),(
  531.     #(ds,value,##(old-search))
  532. ))
  533. again
  534. [*]
  535.  
  536.  
  537. Name:Freplace-with
  538. [*]#(pm,4)
  539. #(Fset-new-mark,.)
  540. #(lp,##(old-search),,arg2,##(F-case-fold-search))
  541. #(SELF-do,arg1)
  542. #(pm)
  543. [*]
  544.  
  545.  
  546. Name:Freplace-with- 
  547. [*]#(Freplace-with-do-do-do)
  548. again
  549. [*]
  550.  
  551.  
  552. Name:Freplace-with-!
  553. [*]#(Freplace-with-do-do-do)
  554. #(an,Changing all,,...)
  555. !
  556. [*]
  557.  
  558.  
  559. Name:Freplace-with-.
  560. [*]#(Freplace-with-do-do-do)
  561. done[*]
  562.  
  563.  
  564. Name:Freplace-with-?
  565. [*]#(ow,(
  566. ' ' to replace.
  567. '.' to replace and quit.
  568. Del to not replace.
  569. Escape to quit.
  570. '!' to replace to end of buffer.
  571. '^' to undo the previous match.
  572. For compatability with Freemacs 1.4:
  573. 'c' to replace to end of buffer.
  574. 'y' to replace.
  575. 'n' to not replace.
  576. ))
  577. #(Fhit-any-key)
  578. again
  579. [*]
  580.  
  581.  
  582. Name:Freplace-with-C-[
  583. [*]done[*]
  584.  
  585.  
  586. Name:Freplace-with-C-g
  587. [*]#(F:ring-the-bell)
  588. quit[*]
  589.  
  590.  
  591. Name:Freplace-with-C-r
  592. [*]#(ds,old-search,##(old-search)
  593.     #(ds,old-replace,##(gs,old-replace,\\,\&)
  594.         #(ds,temp,#(F:recursive-edit,(
  595.             again
  596.             #(an,Query replacing regexp ##(old-search) with ##(old-replace)--'?' for help)
  597.         )))
  598.     )
  599. )##(temp)
  600. [*]
  601.  
  602.  
  603. Name:Freplace-with-Del
  604. [*]#(sp,1)
  605. again
  606. [*]
  607.  
  608.  
  609. Name:Freplace-with-Escape
  610. [*]done[*]
  611.  
  612.  
  613. Name:Freplace-with-^
  614. [*]^[*]
  615.  
  616.  
  617. Name:Freplace-with-do
  618. [*]#(l?,.,],0,1,(
  619.     #(Fcase,#(SELF-do,arg1),
  620.         (again,(
  621.             #(SELF,arg1)
  622.         )),
  623.         (^,(
  624.             #(sm,0,2)
  625.             #(sm,1,3)
  626.             #(SELF-do)
  627.         )),
  628.         (!,(
  629.             #(SELF,!)
  630.         )),
  631.         (done,#(Fmessage,Done)),
  632.         (quit)
  633.     )
  634. ),(
  635.     #(Fmessage,Done)
  636. ))[*]
  637.  
  638.  
  639. Name:Freplace-with-do-do
  640. [*]#(sp,0)
  641. #(n?,Freplace-with-arg1,(
  642.     #(Freplace-with-arg1)
  643. ),(
  644.     #(==,arg1,,,(#(Fflush-input-buffer)))
  645.     #(sv,im,1)
  646.     #(rd)
  647.     #(Fmode-line)
  648.     #(SELF,#(g)#(sv,im,.),arg2)
  649. ))[*]
  650.  
  651.  
  652. Name:Freplace-with-do-do-do
  653. [*]
  654. #(is,
  655.     #(==,##(F-case-replace),,(
  656.         ##(gs,old-replace,,##(rm,1))
  657.     ),(
  658.         #(==,##(nc,##(old-replace)),##(nc,##(old-search)),(
  659.             #(ds,temp,##(rm,1))
  660.             #(Fcase-fold)
  661.         ),(
  662.             ##(gs,old-replace,,##(rm,1))
  663.         ))
  664.     ))
  665.     #(dm,1)
  666.     #(is,!)
  667.     #(sm,2,<)
  668. )
  669. #(sm,3)
  670. #(sp,2)
  671. #(dm,>)
  672. #(sp,3)
  673. [*]
  674.  
  675.  
  676. Name:Freplace-with-n
  677. [*]#(sp,1)
  678. again
  679. [*]
  680.  
  681.  
  682. Name:Freplace-with-y
  683. [*]#(Freplace-with-do-do-do)
  684. again
  685. [*]
  686.  
  687.  
  688. Name:Fsearch-forward
  689. Search forward for the string given in arg1.  Return arg2 if found,
  690. arg3 if not found.  If found, move point to just beyond the end of the
  691. found string.  If arg4 is non-null, interpret arg1 as containing
  692. regexps.  If arg5 is non-null, interpret arg1 as to ignore case.  By
  693. convention, arg4 should be R or null, arg5 should be C or null.
  694.  
  695. [*]#(pm,1)
  696. #(lp,arg1,,arg4,arg5)
  697. #(l?,.,],,0,(
  698.     #(sp,0)
  699.     #(pm)
  700.     arg2
  701. ),(
  702.     #(pm)
  703.     arg3
  704. ))[*]